package com.sharemarking.application.wechat.api;

import com.sharemarking.application.common.api.ResponseParams;
import com.sharemarking.application.wechat.service.BlessService;
import org.apache.http.protocol.HTTP;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;


/**
 * Created by Administrator on 2017/10/13.
 */
@RestController
@RequestMapping(value = "api/bless")
public class BlessApi {
    @Autowired
    BlessService blessService;

    /**
     * 新增祝福
     * @param request
     * @return
     */
    @RequestMapping("addBless")
    public ResponseParams addBless(HttpServletRequest request){
        ResponseParams responseParams = new ResponseParams();
        try {
            responseParams = blessService.addBless(request);
            return responseParams;
        } catch (Exception e) {
            e.printStackTrace();
            responseParams.isError();
            return responseParams;
        }
    }

    /**
     * 获取上传配置
     * @param request
     * @return
     */
    public ResponseParams upload(HttpServletRequest request){
        ResponseParams responseParams = new ResponseParams();
        try {
            responseParams = blessService.upload(request);
            return responseParams;
        } catch (Exception e) {
            e.printStackTrace();
            responseParams.isError();
            return responseParams;
        }
    }
}
